﻿
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using ConsoloWin.model;
using iTextSharp.text;
using iTextSharp.text.pdf;
using Newtonsoft.Json;

namespace ConsoloWin
{
    class Program
    {
        static void Main(string[] args)
        {
            //测试接口
            #region
            //var RequestModel = JsonConvert.SerializeObject(new RequestModel());
            //var url = "http://http://10.1.1.102:570/fybj_jk/RouterService.svc";
            //RequestJsonbody jsonbody = new RequestJsonbody();
            ////请求数据
            //var jsonBody = JsonConvert.SerializeObject(jsonbody);
            //Encoding encoding = Encoding.UTF8;
            ////文本写入到二进制
            //byte[] postData = encoding.GetBytes(JsonConvert.SerializeObject(jsonBody));
            ////创建请求
            //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            //request.Method = "POST";
            //request.ContentType = "application/json";
            //request.ContentLength = postData.Length;
            //Stream myRequestStream = request.GetRequestStream();
            ////二进制写入文件流
            //myRequestStream.Write(postData, 0, postData.Length);
            //myRequestStream.Close();
            ////请求获取返回文件流
            //HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            //Stream myResponseStream = response.GetResponseStream();
            ////文件流转换文本
            //StreamReader myStreamReader = new StreamReader(myResponseStream, encoding);
            //string retString = myStreamReader.ReadToEnd();
            ////返回数据
            //var convertReturn = JsonConvert.DeserializeObject<ResponseModel>(retString);
            #endregion

            //Twomodel.OneRunTime();
            //Twomodel.TwoRuntime();
            //DateTime time = DateTime.Now;
            //time.AddDays(2);

            //var subString = "deadehdsadhjeushddhehsdhsjkdehf".Substring(0, 10);

            Twomodel.LianBanDan();

            //var tt = "1222333";
            //var yy = tt.Substring(0, );

            //Name name = new Name() { Age = "123", Sex ="dede"};

            //var bv = new {
            //    name.Age,
            //    name.Sex
            //};

            //var json = Newtonsoft.Json.JsonConvert.SerializeObject(bv);


            //var str = "123456789".Substring(3);


            //var str = "http://localhost:11111/Temp/NoticeOfReceivingCorpse_lazwz5gt.pdf";

            //var i = str.IndexOf("Temp");

            //var t = str.Substring(i);

            //Twomodel.OneRunTime();
            //{
            //    //Document document = new Document();
            //    //// step 2 保存文档的地址设置   
            //    //PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("D:/PDF/One/HelloWorld.pdf", FileMode.Create));      //FileMode.Create文档不在会创建，存在会覆盖                                                                                                                                                     // step 3 打开文档
            //    //document.Open();
            //    //// step 4 将一个元素添加到文档中
            //    //document.Add(new Paragraph("Hello World!"));
            //    //// step 5 关闭文档 
            //    //document.Close();
            //}


            
        }
    }

    public class Name 
    {
        /// <summary>
        /// 
        /// </summary>
        public string Age { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Sex { get; set; }
    }
}
